package com.itheima.dao;

import com.itheima.domain.User;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

public interface UserDao {
    @Select("select * from user")
    List<User> findAll();

    @Select("select * from user where username = #{username} and password = #{password}")
    User login(User user);

    @Select("insert into user values (#{id},#{name},#{gender},#{age},#{address},#{qq},#{email},null,null)")
    void save(User user);

    @Delete("delete from user where id = #{id}")
    void deleteById(String id);

    @Select("select * from user where id = #{id}")
    User findById(String id);

    @Update("update user set name = #{name},gender = #{gender} ,age = #{age} , address = #{address} , qq = #{qq}, email = #{email} where id = #{id}")
    void update(User user);

}
